apple-actions/import-codesign-certs@v1
Apple-Actions/download-provisioning-profiles@v1
Apple-Actions/upload-testflight-build@master
在此設定:https://appstoreconnect.apple.com/access/api
由鑰匙圈匯出.P12cat XXXXX.p12 | base64 | pbcopy
貼上 Secrets 即可
由鑰匙圈匯出.P12 時所設定之密碼
name: Github Actions
# on: [push, pull_request]
on:
push:
branches: [ Release-Store ]
tags:
- 'Store*'
pull_request:
branches: [ Release-Store ]
jobs:
build:
runs-on: macOS-latest
# container: reactnativecommunity/react-native-android
steps:
- uses: actions/checkout@v2
- name: Envinfo
run: npx envinfo
- name: Run a signing Certificate p12 script
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
- uses: Apple-Actions/download-provisioning-profiles@v1
with:
bundle-id: XX.XX.rn3d
issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }}
- name: 'Another example step'
run: echo ${{ steps.provisioning.outputs.profiles }}
- name: "#️⃣ Generate Build Number"
id: IOSbuild
uses: einaregilsson/build-number@v2
with:
token: ${{ secrets.ACTION_TEST }}
prefix: IOSbuild
- name: "#️⃣ Generate Build Number store"
id: IOSVERSION
uses: einaregilsson/build-number@v2
with:
token: ${{ secrets.ACTION_TEST }}
prefix: IOSVERSION
- name: Print new build number
run: |
echo "Build number is $BUILD_NUMBER"
echo "Build number is $buildnumber" ${{ steps.buildnumber.outputs.build_number }}
echo "IOSVERSION is $buildnumber_store" ${{ steps.IOSVERSION.outputs.build_number }}
echo "IOSbuild is $buildnumber" ${{ steps.IOSbuild.outputs.build_number }}
- name: Install dependencies
run: |
npm install -g react-native-cli
yarn
- name: Install IOS dependencies
run: |
cd ios
pod install
- name: Build app (fix)
run: |
xcodebuild clean archive -workspace ./ios/rn3d.xcworkspace -scheme rn3d -configuration Release -archivePath ./ios/build/export.xcarchive -showBuildTimingSummary MARKETING_VERSION=0.0.${{ steps.IOSVERSION.outputs.build_number }} CURRENT_PROJECT_VERSION=`${{ steps.IOSbuild.outputs.build_number }}` archive
- name: Build IPA (APPLE)
run: |
xcodebuild -exportArchive -archivePath ./ios/build/export.xcarchive -exportPath ./build -exportOptionsPlist ./ios/ExportOptions.plist -allowProvisioningUpdates
- uses: Apple-Actions/upload-testflight-build@master
with:
app-path: ./build/rn3d.ipa
issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }}
- name: show job status 3
if: always()
id: job_status
run: echo $status
env:
status: ${{job.status}}
配置發布方案
構建要在App Store中分發的應用程序需要使用ReleaseXcode中的方案。專為構建Release的應用程序將自動禁用應用程序內開發人員菜單,這將防止您的用戶無意間訪問生產環境中的菜單。它還將在本地捆綁JavaScript,因此您可以將應用程序放在設備上並在未連接到計算機的情況下進行測試。
要將您的應用配置為使用Release方案構建,請轉到產品→方案→編輯方案。選擇邊欄中的“運行”選項卡,然後將“構建配置”下拉列表設置為Release。
構建要發布的應用程序
現在,您可以通過點擊⌘B或從菜單欄中選擇產品→構建來構建要發布的應用程序。構建發行版後,您就可以將應用分發給Beta測試人員,並將其提交到App Store。
您還可以使用React Native CLI來通過--configuration帶有值Release(例如npx react-native run-ios --configuration Release)的選項執行此操作。